#bin/bash
git_prefix=".git"
if [ ! -d "$git_prefix" ]; then
	echo "! [Illegal git repository directory]"
	echo "  移动脚本到git仓库根目录"
	exit 1
fi

branch_name=$1
if [ -z "$branch_name" ];then
	echo "! [Branch name missing]"
	echo "  需要review的分支名称不能为空，请补充"
	exit 1
fi
#echo $branch_name
git push --receive-pack='git receive-pack --reviewer fuchaoyang@lianjia.com --reviewer zhaoruichao@lianjia.com --reviewer zhangqiang01@lianjia.com --reviewer xiejiangquan@lianjia.com' origin HEAD:refs/for/$branch_name
if [ $? -eq 0 ]; then
	exit 0
else
	exit 1
fi
